#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright (c) 2024 Kaelin Laundry
#
# This file is part of the modm project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# -----------------------------------------------------------------------------

def init(module):
    module.name = ":platform:can.common.fdcan"
    module.description = "FDCAN common"

def prepare(module, options):
    device = options[":target"]
    if not device.has_driver("fdcan:stm32*") and not device.has_driver("mcan:sam*"):
        return False

    module.depends(
        ":architecture:assert",
        ":architecture:can",
        ":architecture:clock")
    return True

def build(env):
    env.outbasepath = "modm/src/modm/platform/can"
    env.copy("message_ram.hpp")
